/**
 * Author: Dmitry Ustimov
 * Date: 5/11/13
 * Time: 9:56 PM
 */

package com.gmail.dmitryustimov.ms.java7.composite.mod.example;

public class Composite<T> extends Component<T> {

    private String name;

    public Composite(String name) {
        super();
        this.name = name;
    }

    public boolean isComposite() {
        return true;
    }

    @Override
    public void doAction() {
        System.out.println("Do something on a composite: " + name);
        for (Component<T> c: components) {
            System.out.print("--->");
             c.doAction();
        }
    }
}
